package com.eisei.factory.tbl;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Created by equipo.crea on 3/08/14.
 */
@Entity
@Table(name = "TBL_REL_GRUPO_ROL", schema = "SIS_GES_CALIDAD", catalog = "")
@IdClass(TblRelGrupoRolEntityPK.class)
public class TblRelGrupoRolEntity {
    private BigDecimal fkCatRolGrupo;
    private BigDecimal fkCatRol;
    private TblCatRolEntity tblCatRolByFkCatRol;
    private TblCatRolGruposEntity tblCatRolGruposByFkCatRolGrupo;

    @Id
    @Column(name = "FK_CAT_ROL_GRUPO", nullable = false, insertable = true, updatable = true, length = 0, precision = -127)
    public BigDecimal getFkCatRolGrupo() {
        return fkCatRolGrupo;
    }

    public void setFkCatRolGrupo(BigDecimal fkCatRolGrupo) {
        this.fkCatRolGrupo = fkCatRolGrupo;
    }

    @Id
    @Column(name = "FK_CAT_ROL", nullable = false, insertable = true, updatable = true, length = 0, precision = -127)
    public BigDecimal getFkCatRol() {
        return fkCatRol;
    }

    public void setFkCatRol(BigDecimal fkCatRol) {
        this.fkCatRol = fkCatRol;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TblRelGrupoRolEntity that = (TblRelGrupoRolEntity) o;

        if (fkCatRol != null ? !fkCatRol.equals(that.fkCatRol) : that.fkCatRol != null) return false;
        if (fkCatRolGrupo != null ? !fkCatRolGrupo.equals(that.fkCatRolGrupo) : that.fkCatRolGrupo != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = fkCatRolGrupo != null ? fkCatRolGrupo.hashCode() : 0;
        result = 31 * result + (fkCatRol != null ? fkCatRol.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "FK_CAT_ROL", referencedColumnName = "PK_CAT_ROL", nullable = false)
    public TblCatRolEntity getTblCatRolByFkCatRol() {
        return tblCatRolByFkCatRol;
    }

    public void setTblCatRolByFkCatRol(TblCatRolEntity tblCatRolByFkCatRol) {
        this.tblCatRolByFkCatRol = tblCatRolByFkCatRol;
    }

    @ManyToOne
    @JoinColumn(name = "FK_CAT_ROL_GRUPO", referencedColumnName = "PK_CAT_ROL_GRUPO", nullable = false)
    public TblCatRolGruposEntity getTblCatRolGruposByFkCatRolGrupo() {
        return tblCatRolGruposByFkCatRolGrupo;
    }

    public void setTblCatRolGruposByFkCatRolGrupo(TblCatRolGruposEntity tblCatRolGruposByFkCatRolGrupo) {
        this.tblCatRolGruposByFkCatRolGrupo = tblCatRolGruposByFkCatRolGrupo;
    }
}
